package com.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.demo.entity.PhysicalPreventionLog;
import java.util.Date;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author zhanghong
 */
public interface PhysicalPreventionLogMapper extends BaseMapper<PhysicalPreventionLog> {

    Map<String, Integer> getTotalHourAndTimes(@Param("patientId") Integer patientId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    @Select("select count(1) from pd_physical_prevention_log where vte_preventive_id=#{doctorAdviceId}")
    Integer queryByVtePreventiveId(@Param("doctorAdviceId") Integer doctorAdviceId);

    @Select("select * from pd_physical_prevention_log where patient_id = #{patientId} and end_time > #{nowDate} and start_time < #{nowDate}")
    PhysicalPreventionLog getOngoingTreatmentByPatientId(@Param("patientId") Integer patientId, @Param("nowDate") Date nowDate);
}
